<?php

namespace app\common\model\score;

use think\Model;


class Orders extends Model
{


    // 表名
    protected $table = 'score_orders';

    // 自动写入时间戳字段
    protected $autoWriteTimestamp = 'integer';

    // 定义时间戳字段名
    protected $createTime = 'createtime';
    protected $updateTime = 'updatetime';
    protected $deleteTime = false;

    // 追加属性
    protected $append = [
        'award_type_text'
    ];

    public function getAwardTypeTextAttr($value, $data)
    {
        $value = $value ? $value : (isset($data['award_type']) ? $data['award_type'] : '');
        $list = $this->getAwardTypeList();
        return isset($list[$value]) ? $list[$value] : '';
    }

    public function getAwardTypeList()
    {
        return [1 => '银币', 2 => '金币', 3 => '积分', 4 => '钻石', 0 => '其他'];
    }

}
